<?php

declare(strict_types=1);

namespace app\admin\controller;

use addons\Builder\facade\Builder;
use think\response\Json;
//该文件为自动生成，请按需修改
class Team extends Base
{
    //主键，默认为id
    protected string $pk = 'id';

    //主模型
    protected string $model = '\app\common\model\Team';
    //追加虚拟字段
    protected  $append = [
        'team_text',
        'money_text'
    ];
    //排序
    protected array $sort = [
        'id' => 'asc'
    ];

    public function index(): string
    {
        return Builder::Table()
            ->autoStructure($this->model, $this->pk, 'barDemo,200')
            ->addRightButtons(['edit' => ['size' => '50%']])
            ->addSearch([
                ['title', '级别名称搜索', 'input,Like'],
            ], false)
            ->fetch();
    }
    public function save($param = [], $model = false): Json
    {
        $param = $this->request->post();
        $param['award'] = $param['award'] / 100;
        return parent::save($param, $model); // TODO: Change the autogenerated stub
    }
    
    public function edit($id = '', $tpl = '', $info = '')
    {
        return parent::edit($id, 'team/edit', $info); // TODO: Change the autogenerated stub
    }
}
